//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.dao.wills.BaseDao;
import com.aidong.model.wills.ContractSignConfirm;
import org.springframework.stereotype.Repository;

@Repository
public class ContractSignConfirmDao extends BaseDao<ContractSignConfirm, Integer> {
	public ContractSignConfirmDao() {
	}

	public ContractSignConfirm getBySaleId(int saleId, String contractType) {
		return (ContractSignConfirm)this.getByWhere("saleId=:p1 and contractType=:p2", new Object[]{Integer.valueOf(saleId), contractType});
	}

	public void updatePrint(ContractSignConfirm signConfirm) {
		String sql = "update ContractSignConfirm set printLabel=:p1, printTime=:p2, printUser=:p3 where autoId=:p4";
		this.updateBySql(sql, new Object[]{signConfirm.getPrintLabel(), signConfirm.getPrintTime(), signConfirm.getPrintUser(), signConfirm.getAutoId()});
		if("01".equals(signConfirm.getContractType())) {
			sql = "update MemberContract set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("02".equals(signConfirm.getContractType())) {
			sql = "update PtContract set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("03".equals(signConfirm.getContractType())) {
			sql = "update MemberEarnest set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("04".equals(signConfirm.getContractType())) {
			sql = "update MemberStopedCard set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("05".equals(signConfirm.getContractType())) {
			sql = "update MemberTransfer set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("06".equals(signConfirm.getContractType())) {
			sql = "update MemberChangeShop set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("07".equals(signConfirm.getContractType())) {
			sql = "update MemberChangeCard set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("08".equals(signConfirm.getContractType())) {
			sql = "update BoxRent set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else if("09".equals(signConfirm.getContractType())) {
			sql = "update KyContract set printLabel=:p1, printTime=:p2, printUser=:p3 where saleId=:p4";
		} else {
			if(!"10".equals(signConfirm.getContractType())) {
				return;
			}

			sql = "update PtBespeak set printLabel=:p1, printTime=:p2, printUser=:p3 where autoId=:p4";
		}

		this.updateBySql(sql, new Object[]{signConfirm.getPrintLabel(), signConfirm.getPrintTime(), signConfirm.getPrintUser(), signConfirm.getSaleId()});
	}
}
